'\" t
.\"     Title: glib-compile-resources
.\"    Author: Alexander Larsson
.\" Generator: DocBook XSL Stylesheets vsnapshot <http://docbook.sf.net/>
.\"      Date: 01/08/2018
.\"    Manual: User Commands
.\"    Source: GIO
.\"  Language: English
.\"
.TH "GLIB\-COMPILE\-RESOU" "1" "" "GIO" "User Commands"
.\" -----------------------------------------------------------------
.\" * Define some portability stuff
.\" -----------------------------------------------------------------
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.\" http://bugs.debian.org/507673
.\" http://lists.gnu.org/archive/html/groff/2009-02/msg00013.html
.\" ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
.ie \n(.g .ds Aq \(aq
.el       .ds Aq '
.\" -----------------------------------------------------------------
.\" * set default formatting
.\" -----------------------------------------------------------------
.\" disable hyphenation
.nh
.\" disable justification (adjust text to left margin only)
.ad l
.\" -----------------------------------------------------------------
.\" * MAIN CONTENT STARTS HERE *
.\" -----------------------------------------------------------------
.SH "NAME"
glib-compile-resources \- GLib resource compiler
.SH "SYNOPSIS"
.HP \w'\fBglib\-compile\-resources\fR\ 'u
\fBglib\-compile\-resources\fR [OPTION...] {FILE}
.SH "DESCRIPTION"
.PP
\fBglib\-compile\-resources\fR
reads the resource description from
\fIFILE\fR
and the files that it references and creates a binary resource bundle that is suitable for use with the
\fBGResource\fR
API\&. The resulting bundle is then written out as\-is, or as C source for linking into an application\&.
.PP
The XML resource files normally have the filename extension
\&.gresource\&.xml\&. For a detailed description of the XML file format, see the
\fBGResource\fR
documentation\&.
.SH "OPTIONS"
.PP
\fB\-h\fR, \fB\-\-help\fR
.RS 4
Print help and exit
.RE
.PP
\fB\-\-version\fR
.RS 4
Print program version and exit
.RE
.PP
\fB\-\-target=\fR\fB\fITARGET\fR\fR
.RS 4
Store the compiled resources in the file
\fITARGET\fR\&. If not specified a filename based on the
\fIFILE\fR
basename is used\&.
.RE
.PP
\fB\-\-sourcedir=\fR\fB\fIDIRECTORY\fR\fR
.RS 4
The files referenced in
\fIFILE\fR
are loaded from this directory\&. If not specified, the current directory is used\&.
.RE
.PP
\fB\-\-generate\fR
.RS 4
Write the output file in the format selected for by its filename extension:
.PP
\&.c
.RS 4
C source
.RE
.PP
\&.h
.RS 4
C header
.RE
.PP
\&.gresource
.RS 4
resource bundle
.RE
.sp
.RE
.PP
\fB\-\-generate\-source\fR
.RS 4
Instead of a writing the resource bundle in binary form create a C source file that contains the resource bundle\&. This can then be compiled into an application for easy access\&.
.RE
.PP
\fB\-\-generate\-header\fR
.RS 4
Generate a header file for use with C code generated by
\fB\-\-generate\-source\fR\&.
.RE
.PP
\fB\-\-generate\-dependencies\fR
.RS 4
Prints the list of files that the resource bundle references to standard output\&. This can be used to track dependencies in the build system\&. For example, the following make rule would mark
\fItest\&.gresource\fR
as depending on all the files that
\fItest\&.gresource\&.xml\fR
includes, so that is is automatically rebuilt if any of them change:
.sp
.if n \{\
.RS 4
.\}
.nf
test\&.gresource: test\&.gresource\&.xml $(shell $(GLIB_COMPILE_RESOURCES) \-\-generate\-dependencies test\&.gresource\&.xml)
.fi
.if n \{\
.RE
.\}
.sp
Note that this may or may not be portable to non\-GNU
\fBmake\fR\&.
.sp
Also see
\fB\-\-dependency\-file\fR\&.
.RE
.PP
\fB\-\-c\-name\fR
.RS 4
Specify the prefix used for the C identifiers in the code generated by
\fB\-\-generate\-source\fR
and
\fB\-\-generate\-header\fR\&.
.RE
.PP
\fB\-\-manual\-register\fR
.RS 4
By default code generated by
\fB\-\-generate\-source\fR
uses automatic initialization of the resource\&. This works on most systems by using the compiler support for constructors\&. However, some (uncommon) compilers may not support this, you can then specify
\fB\-\-manual\-register\fR, which will generate custom register and unregister functions that your code can manually call at initialization and uninitialization time\&.
.RE
.PP
\fB\-\-internal\fR
.RS 4
By default code generated by
\fB\-\-generate\-source\fR
declares all initialization functions as
\fBextern\fR\&. So they are exported unless this is prevented by a link script or other means\&. Since libraries usually want to use the functions only internally it can be more useful to declare them as
G_GNUC_INTERNAL
which is what
\fB\-\-internal\fR
does\&.
.RE
.PP
\fB\-\-dependency\-file=\fR\fB\fIFILE\fR\fR
.RS 4
Write dependencies in the same style as gcc \-M \-MF to the given file\&. If
\fBFILE\fR
is \-, the dependencies are written to the standard output\&. Unlike
\fB\-\-generate\-dependencies\fR, this option can be combined with other
\fB\-\-generate\fR
options to generate dependencies as a side\-effect of generating sources\&.
.RE
.PP
\fB\-\-generate\-phony\-targets\fR
.RS 4
When creating a dependency file with
\fB\-\-dependency\-file\fR
include phony targets in the same style as gcc \-MP\&. This would typically be used with
make\&.
.RE
.SH "ENVIRONMENT"
.PP
\fBXMLLINT\fR
.RS 4
The full path to the xmllint executable\&. This is used to preprocess resources with the
xml\-stripblanks
preprocessing option\&. If this environment variable is not set, xmllint is searched in the
\fBPATH\fR\&.
.RE
.PP
\fBGDK_PIXBUF_PIXDATA\fR
.RS 4
The full path to the gdk\-pixbuf\-pixdata executable\&. This is used to preprocess resources with the
to\-pixdata
preprocessing option\&. If this environment variable is not set, gdk\-pixbuf\-pixdata is searched in the
\fBPATH\fR\&.
.RE
